package com.boot.ys.mybatisplus.service.impl;

import com.boot.ys.mybatisplus.entity.TPhone;
import com.boot.ys.mybatisplus.entity.TPhoneResultEntity;
import com.boot.ys.mybatisplus.mapper.TPhoneMapper;
import com.boot.ys.mybatisplus.service.TPhoneService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Yang Sheng
 * @since 2021-12-13
 */
@Service
public class TPhoneServiceImpl extends ServiceImpl<TPhoneMapper, TPhone> implements TPhoneService {

    @Autowired
    private TPhoneMapper tPhoneMapper;


    @Override
    public List<TPhoneResultEntity> getPhoneList() {
        List<TPhoneResultEntity> tPhoneEntities = tPhoneMapper.getPhoneList();

        for (int i = 0 ; i<tPhoneEntities.size() ; i++ ){
            TPhoneResultEntity tPhone = tPhoneEntities.get(i);
            //照图片按照；分隔
            String pics = tPhone.getPics();
            String[] picsA = pics.split(";");
            tPhone.setPicsArray(picsA);
            //配置说明按：分隔
            String dispose = tPhone.getDispose();
            String[] disposeA = dispose.split(";");
            tPhone.setDisposeArray(disposeA);
        }
        String[] picsArray = tPhoneEntities.get(0).getPicsArray();
        String s = picsArray[0];
        String s1 = picsArray[1];
        System.out.println(s+"------"+s1);

        return tPhoneEntities;
    }
}
